from flask import Flask, Blueprint
from flask.cli import AppGroup
import click
from werkzeug.serving import run_simple

app = Flask(__name__)
user_cli = AppGroup('user')

@user_cli.command('create')
@click.argument('name')
def create_user(name):
    app.logger.info("create user: " + name)

app.cli.add_command(user_cli)

bp = Blueprint('students', __name__, cli_group='other')
@bp.cli.command('create')
@click.argument('name')
def create(name):
    app.logger.info('create stu:' + name)

app.register_blueprint(bp)

@app.route('/')
def index():
    return "index"

if __name__ == "__main__":
    # app.run(host='0.0.0.0', port=8000, debug=True)
    run_simple('localhost', 5000, app, use_reloader=True)
    run_simple('localhost', 6000, app, use_reloader=True)